/*
 * PCL.h
 *
 *  Created on: 2012. 10. 15.
 *      Author: dalxx
 */

#include <Arduino.h>
#include "PLCLib/PLCConfig.h"

#ifndef PCL_H_
#define PCL_H_


#include "PLCLib/RelayContainer.h"
class PLC;
struct PLC_CMD_HANDLER
{
	void (PLC::*(Handler))();
	const char* CMD;
};
struct EEPROM_Variable
{
	char* start;
	int size;
};

class PLC {
private:
	char full_buffer[BUFFER_SIZE];
	PLCLib::RelayContainer container;
	 EEPROM_Variable eePlcVariables[EEPROM_VARIABLE_NUMBER];
	Stream* cmdConsole;

public:

	static const char* CMD_PLC_SET;
	static const char* CMD_STOP;
	static const char* CMD_START;
	static const char* CMD_CHANG_MOD;
	static const char* CMD_STATUS;
	static const char* CMD_EEPROM_CLEAR;
	static const char* CMD_EEPROM_READ;
	static const char* CMD_EEPROM_WRITE_STATUS;


	static const char* OUT_OK;
	static const char* EEPROM_KEWORD;
	static const char* ERR_FMT_PLC_SET;


public:

	PLC(Stream& _cmdReader);
	virtual ~PLC();
	void doPLC();
	void processCommand();
	void initFromEEPROM(bool isCmdSet=false);
	void writeStatusToEEPROM();





};

#endif /* PCL_H_ */
